<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">
        <div><?php include "../public_flow/flow_show_info.php";?></div>
        <div class="tongbox tongbox5">
            <div class="tuo"><div class="tit">项目名称</div><div class="con" id="tong_enginname"></div></div>
            <div class="tuo"><div class="tit">入库单号</div><div class="con" id="tong_number"></div></div>
            <div class="tuo"><div class="tit">供应商</div><div class="con" id="tong_gonger"></div></div>
            <div class="tuo"><div class="tit">入库金额(元)</div><div class="con" id="tong_money"></div></div>
            <div class="tuo"><div class="tit">入库日期</div><div class="con" id="tong_rudt"></div></div>
        </div>
        <div class="table-box tablenes">
            <div class="title">项目信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">项目名称</td><td class="tv colorlan" id="enginid_name" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>
        <div class="table-box tablenes">
            <div class="title">基本信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">入库主题</td><td id="title" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">入库单号</td><td id="number" class="tv"></td><td class="tt">入库类型</td><td id="rutype_name" class="tv"></td></tr>
                <tr class="rutype1 layui-hide"><td  class="tt">关联支出合同</td><td id="caiid_name" class="colorlan tv" colspan="3"></td></tr>
                <tr class="rutype2 layui-hide"><td  class="tt">关联采购单</td><td id="buyid_name" class="colorlan tv" colspan="3"></td></tr>
                <tr><td class="tt">供应商</td><td id="gonger" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">入库金额(元)</td><td id="money" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">入库日期</td><td id="rudt" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">入库人</td><td id="baner" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">是否直接出库</td><td id="ischu" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">领料人</td><td id="baner_chu" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">备注</td><td id="explain" colspan="3" class="tv"></td></tr>

                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>
        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>
        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">入库明细</script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>


        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_stuff_ru_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;
                $("#flowdingname").text(data.title);

                if(engininfo){
                    $("#tong_enginname").text(engininfo.name);
                }
                $("#tong_number").text(data.number);
                $("#tong_gonger").text(data.gonger);
                $("#tong_money").text(parseFormatNum(data.money));
                $("#tong_rudt").text(data.rudt);












                if(engininfo){
                    $("#enginid_name").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });
                }

                if(data.rutype == 1){
                    $(".rutype1").removeClass('layui-hide');
                    var caiidinfo = res.data.caiidinfo;
                    $("#caiid_name").text(caiidinfo.name).click(function () {
                        openPage('../contract_cai/show.php?id='+caiidinfo.id);
                    });
                }
                if(data.rutype == 2){
                    $(".rutype2").removeClass('layui-hide');
                    var buyidinfo = res.data.buyidinfo;
                    $("#buyid_name").text(buyidinfo.title).click(function () {
                        openPage('../contract_buy/show.php?id='+buyidinfo.id);
                    });
                }


                $("#title").text(data.title);
                $("#number").text(data.number);
                $("#rutype_name").text(data.rutype_name);
                $("#gonger").text(data.gonger);
                $("#money").text(showChineseNumber(data.money));
                $("#rudt").text(data.rudt);
                $("#baner").text(data.baner);
                $("#ischu").text(data.ischu);
                $("#baner_chu").text(data.baner_chu);
                $("#explain").text(data.explain);


                var mytableList = table.render({
                    elem: "#datalist",data:res.data.list, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field: 'name', title: '物资名称及规格'}
                        ,{field: 'unit', title: '单位'}
                        ,{field: 'price', title: '单价(元)',align:'right',templet: function(d){return parseFormatNum(d.price);}}
                        ,{field: 'num', title: '入库数量'}
                        ,{field: 'money', title: '入库金额(元)',align:'right',templet: function(d){return parseFormatNum(d.money);}}
                        ,{field: 'explain', title: '备注'}
                        ,{field: 'chunum', title: '已出库数量'}
                        ,{field: 'chumoney', title: '已出库金额(元)',align:'right',templet: function(d){return parseFormatNum(d.chumoney);}}
                        ,{field: 'tuinum', title: '已退库数量'}
                        ,{field: 'tuimoney', title: '已退库金额(元)',align:'right',templet: function(d){return parseFormatNum(d.tuimoney);}}
                        ,{field: 'cunnum', title: '剩余库存数量'}
                        ,{field: 'cunmoney', title: '剩余库存金额(元)',align:'right',templet: function(d){return parseFormatNum(d.cunmoney);}}
                        ,{field: 'yongnum', title: '耗用数量'}
                        ,{field: 'yongmoney', title: '耗用金额(元)',align:'right',templet: function(d){return parseFormatNum(d.yongmoney);}}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });




                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('stuff_ru', param_id);
    });



</script>
</body>
</html>




